<?php
class Aboutcountry
{
    /**
     * @var object Zend DB Adapter
     */
    private $_db;
    
    public function __construct()
    {
			$this->_db = Zend_Registry::get('db');
    }
    
    public function listPageContentAboutCountry()
    {
    	$this->_db->query( "set names 'utf8'" ) ;
    	$rec_arr = $this->_db->fetchAll("
    		SELECT * FROM about_country
                WHERE category = 'About Sri Lanka'
    	");
    	
    	return $rec_arr;
    }

    public function listMapContentAboutCountry()
    {
    	$this->_db->query( "set names 'utf8'" ) ;
    	$rec_arr = $this->_db->fetchAll("
    		SELECT * FROM about_country
                WHERE category  != 'About Sri Lanka' AND
                category != 'Water Falls' AND
                category != 'National Parks'
    	");

    	return $rec_arr;
    }
    
    public function getPageDetailsByCategory($page_id)
    {
    	$this->_db->query( "set names 'utf8'" ) ;
        $sql="
    		SELECT * FROM about_country
    		WHERE page_id = '" . $page_id . "' ";
    //    echo $sql;exit;
    	$rec_arr = $this->_db->fetchAll($sql);
    	
    	return $rec_arr;
    }

     public function getCampaignDetailsBynationalparrk($nationalparkid)
    {
    	$this->_db->query( "set names 'utf8'" ) ;
    	$rec_arr = $this->_db->fetchAll("
    		SELECT * FROM campaign
    		WHERE nationalpark = '" . $nationalparkid . "' "
    	);

    	return $rec_arr;
    }

      public function getCampaignDetails($campaignid)
    {
    	$this->_db->query( "set names 'utf8'" ) ;
        $sql="
    		SELECT * FROM campaign
    		WHERE id = '" . $campaignid . "' ";
    	$rec_arr = $this->_db->fetchRow($sql);

    	return $rec_arr;
    }
    
    public function getPageDetailsById($page_id)
    {
    	$this->_db->query( "set names 'utf8'" ) ;
    	$rec_arr = $this->_db->fetchRow("
    		SELECT * FROM about_country
    		WHERE page_id = " . $page_id);
    	
    	return $rec_arr;
    }
    
    public function listByCategory($category)
    {
    	$sql = "SELECT * FROM about_country
    			WHERE category = '" . $category . "' ";
    	$arr = $this->_db->fetchAll($sql );
    	
    	return $arr;
    }
} 
?>